﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StockMarketTool.Model
{
    public class CodeValueModel : NotifyBase
    {
        private string _code;

        public string Code
        {
            get { return _code; }
            set
            {
                _code = value;
                RaisePropertyChanged("Code");
            }
        }
        private string _name;

        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                RaisePropertyChanged("Name");
            }
        }

        private double _curValue = 0.0d;
        /// <summary>
        /// 当前价格
        /// </summary>
        public double CurValue
        {
            get { return _curValue; }
            set
            {
                _curValue = value;
                RaisePropertyChanged("CurValue");
            }
        }
        private double _princeChange = 0.0d;
        /// <summary>
        /// 价格变化
        /// </summary>
        public double PrinceChange
        {
            get { return _princeChange; }
            set
            {
                _princeChange = value;
                RaisePropertyChanged("PrinceChange");
            }
        }
        private double _princeChangePercent = 0.0d;
        /// <summary>
        /// 价格变化百分比
        /// </summary>
        public double PrinceChangePercent
        {
            get { return _princeChangePercent; }
            set
            {
                _princeChangePercent = value;
                RaisePropertyChanged("PrinceChangePercent");
            }
        }
        private bool isSelected;

        public bool IsSelected
        {
            get { return isSelected; }
            set
            {
                isSelected = value;
                RaisePropertyChanged("IsSelected");
            }
        }


        private bool _isShow;

        public bool IsShow
        {
            get { return _isShow; }
            set
            {
                _isShow = value;
                RaisePropertyChanged("IsShow");
            }
        }
        private int _sort;

        public int Sort
        {
            get { return _sort; }
            set
            {
                _sort = value;
                RaisePropertyChanged("Sort");
            }
        }
        private ItemStatus _status = ItemStatus.None;
        [JsonIgnore]
        public ItemStatus Status
        {
            get { return _status; }
            set
            {
                _status = value;
                RaisePropertyChanged("Status");
            }
        }
        private NotifyTypeEnums _notifyType=NotifyTypeEnums.不提醒;
        /// <summary>
        /// 提醒类型，默认不提醒
        /// </summary>
        [JsonIgnore]
        public NotifyTypeEnums NotifyType
        {
            get { return _notifyType; }
            set
            {
                _notifyType = value;
                RaisePropertyChanged("NotifyType");
            }
        }
        private bool _isLestThen;
        /// <summary>
        /// 提醒类型为价格时，比对条件是否小于
        /// </summary>
        [JsonIgnore]
        public bool IsLestThen
        {
            get { return _isLestThen; }
            set
            {
                _isLestThen = value;
                RaisePropertyChanged("IsLestThen");
            }
        }

        private double? _notifyValue;
        /// <summary>
        /// 提醒边界值，默认空
        /// </summary>
        [JsonIgnore]
        public double? NotifyValue
        {
            get { return _notifyValue; }
            set
            {
                _notifyValue = value;
                RaisePropertyChanged("NotifyValue");
            }
        }
        private bool _playNotifyMusic;
        /// <summary>
        /// 提醒时是否播放声音
        /// </summary>
        [JsonIgnore]
        public bool PlayNotifyMusic
        {
            get { return _playNotifyMusic; }
            set
            {
                _playNotifyMusic = value;
                RaisePropertyChanged("PlayNotifyMusic");
            }
        }

    }

    /// <summary>
    /// 股票项状态
    /// </summary>
    public enum ItemStatus
    {
        /// <summary>
        /// 无
        /// </summary>
        None,
        /// <summary>
        /// 添加
        /// </summary>
        Add,
        /// <summary>
        /// 删除
        /// </summary>
        Delete,
        /// <summary>
        /// 关注
        /// </summary>
        Focus
    }

    /// <summary>
    /// 提醒类型
    /// </summary>
    public enum NotifyTypeEnums
    {
        不提醒,
        价格, 
        价格变动, 
        价格变动百分比
    }
}
